package cn.tedu.ivos.application.controller;

import cn.tedu.ivos.application.pojo.dto.ApplicationQuery;
import cn.tedu.ivos.application.pojo.dto.ApplicationSaveParam;
import cn.tedu.ivos.application.pojo.vo.ApplicationVO;
import cn.tedu.ivos.application.service.ApplicationService;
import cn.tedu.ivos.base.response.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
@Slf4j
@RestController
@RequestMapping("/v1/application/")
public class ApplicationController {

    @Autowired
    private ApplicationService service;

    @PostMapping("save")
    public JsonResult save(ApplicationSaveParam applicationSaveParam)
    {
        service.save(applicationSaveParam);
        return JsonResult.ok();
    }

    @GetMapping("select")
    public JsonResult select(ApplicationQuery query)
    {
        log.debug("传入参数={}",query);
        List<ApplicationVO> list  = service.select(query);
        return JsonResult.ok(list);
    }


}
